<include file="Public/head"/>

<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="cf">
                            <form class="form-inline" action="" method="get">
                                    <label class="inline">班级</label>
                                    <select name="class_id" id="class_id" class="form-control">
                                        <option value="">--请选择班级--</option>
                                        <volist name='class_level' id='val'>
                                            <option <if condition="$val['id'] eq I('class_id')">selected='selected'</if> value="{$val['id']}">{$val['type']}--{$val['name']}</option>
                                        </volist> 
                                    </select>
                                    <label class="inline">姓名</label>
                                    <input type='text' name="name" id="name" value="{:I('name')}" class="form-control" />
                                    <label class="inline">手机号码</label>
                                    <input type='text' name="phone" id="phone" value="{:I('phone')}" class="form-control" />
                                <button type="button" onclick="sou()" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                                <!-- <button type="button" onClick="dayin()" class="btn btn-purple btn-sm">
                                    <span class="ace-icon   icon-on-right bigger-110"></span>
                                    打印
                                </button> -->
                            </form>
                        </div>
                    <div class="space-4"></div>
                    <form id="form" method="post" action="{:U('del')}">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>用户</th>
                                <th>身份证号</th>
                                <th>手机</th>
                                <th>驾照</th>
                                <th>班型</th>
                                <th>价格</th>
                                <th>是否已付款</th>
                                <th>报名时间</th>
                                <th>学车进度</th>
                                <th>学员状态</th>
                                <!-- <th>操作</th> -->
                            </tr>
                            </thead>
                            <tbody>

                            <foreach name="data" item="val">
                                <tr>
                                    <td>{$val['user_name']}</td>
                                    <td>{$val['id_card']}</td>
                                    <td>{$val['phone']}</td>
                                    <td>{$val['type']}</td>
                                    <td>{$val['class_name']}</td>
                                    <td>￥&nbsp;{$val['money']}</td>
                                    <!--<td>{$val['is_paid']}</td>-->
                                    <if condition="$val['is_paid'] eq 0">
                                        <td>未付款</td>
                                        <elseif condition="$val['is_paid'] eq 1"/>
                                        <td>已付款</td>
                                    </if>
                                        <td>{$val['add_time']|date="Y-m-d H:i:s",###}</td>

                                        <td>
                                            <select name="schedule" onchange="setSchedule(this)">
                                                <option <if condition="$val['schedule'] eq 0" >selected='selected' </if>  value="0-{$val['id']}">科目一</option>
                                                <option <if condition="$val['schedule'] eq 1" >selected='selected' </if>  value="1-{$val['id']}">科目二</option>
                                                <option <if condition="$val['schedule'] eq 2" >selected='selected' </if>  value="2-{$val['id']}">科目三</option>
                                                <option <if condition="$val['schedule'] eq 3" >selected='selected' </if>  value="3-{$val['id']}">科目四</option>
                                            </select>
                                        </td>

                                    <td>
                                        <select name="status"  onchange="setStatus(this)">
                                                <option <if condition="$val['status'] eq 0" >selected='selected' </if>  value="0-{$val['id']}">退学</option>
                                                <option <if condition="$val['status'] eq 1" >selected='selected' </if>  value="1-{$val['id']}"><font color='green'>正常</font></option>
                                                <option <if condition="$val['status'] eq 2" >selected='selected' </if>  value="2-{$val['id']}"><font color='red'>未报到</font></option>
                                        </select>
                                    </td>
                                    <!-- <td><a href="javascript:;" val="{:U('del',array('id'=>$val['id']))}" class="del"><i
                                                class="ace-icon fa fa-trash-o bigger-100 red"></i>&nbsp;删除</a></td> -->
                                </tr>
                            </foreach>
                            <if condition="$data eq null"><tr><td colspan="11" align="center">没有数据！</td></tr></if>
                            </tbody>
                        </table>
                    </form>
                    {$page}
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $(".check-all").click(function () {
            $(".comments").prop("checked", this.checked);
        });
        $(".comments").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除此类驾照？？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除此类驾照？",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
});

function setStatus(a){
    var status = a.value;
     $.ajax({
            url: "{:U('Student/status')}",
            type: 'post',
            dataType: 'json',
            data: {'param': status},
            success : function (res){
                bootbox.dialog({
                    title: '友情提示：',
                    message: res.msg,
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return false; 
           }
        })

 }
 function setSchedule(a){
    var schedule = a.value;
    $.ajax({
            url: "{:U('Student/schedule')}",
            type: 'post',
            dataType: 'json',
            data: {'param': schedule},
            success : function (res){
                bootbox.dialog({
                    title: '友情提示：',
                    message: res.msg,
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return false; 
           }
        })

 }

//搜索
function sou(){
    phone = $.trim($('#phone').val());
    class_id = $.trim($('#class_id').val());
    name = $.trim($('#name').val());
    var param = '';
    if(class_id){
        param += '/class_id/'+class_id; 
    }
    if(phone){
        param += '/phone/'+phone;
    }
    if(name != ''){
        param += '/name/'+name;
    }
    location.href="__APP__/Admin/Student/index"+param+".html";
}
function dayin(){ 
    location.href='__APP__/Admin/Student/dayin.html';
}
</script>
</body>
</html>
